import App from './App'
import Vue from 'vue'
import store from '@/store/index.js'
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)

Vue.config.productionTip = false
App.mpType = 'app'

const app = new Vue({
	...App,
	store
})
app.$mount()
// 引入请求封装，将app参数传递到配置中
require('@/config/request.js')(app)

// 拦截器
uni.addInterceptor('switchTab', {
	invoke(args) {
		if (args.url == '/pages/mine/mine') {
			// 如果没有登录
			if (!store.state.userInfo) {
				uni.navigateTo({
					url: '/subpages/login/login'
				});
				// 拦截
				return false
			}
		}
	},
	success(args) {},
	fail(err) {},
	complete(res) {}
});
